
use crate::{constant::*, plantuml::Plantuml};

use std::fs::{File};
use std::io::Write;
use crate::file::create_dir;

const PUML_DIR : &str = "puml";

impl<'a> Plantuml<'a> {



    pub fn plantuml_file_flush(&mut self)
    {
        let filepath = format!("{}/{}",PUML_DIR,&self.plantuml_path);
        let filename = format!("{}/{}/{}.puml",PUML_DIR,&self.plantuml_path,self.plantuml_function_name);
        create_dir(&filepath);
        let mut output = File::create(filename).unwrap();
        // println!("--->{}",self.plantuml);
        write!(output,"{}",self.plantuml);
        self.plantuml.clear();
        self.plantuml_function_name.clear();
    }
}